/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package at.prospect.manualcreator.entity;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author haui
 */
@Entity
@Table(name = "MANUAL_MANUAL_FRAGE_ZUORDNUNG")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "ManualManualFrageZuordnung.findAll", query = "SELECT m FROM ManualManualFrageZuordnung m"),
    @NamedQuery(name = "ManualManualFrageZuordnung.findByNr", query = "SELECT m FROM ManualManualFrageZuordnung m WHERE m.nr = :nr")})
public class ManualManualFrageZuordnung implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @GeneratedValue(strategy=GenerationType.AUTO)
    @NotNull
    @Column(name = "NR")
    private Integer nr;
    @JoinColumn(name = "MANUAL_FRAGE_NR", referencedColumnName = "ID")
    @ManyToOne(optional = false)
    private ManualFrage manualFrageNr;
    @JoinColumn(name = "MANUAL_NR", referencedColumnName = "NR")
    @ManyToOne(optional = false)
    private Manual manualNr;

    public ManualManualFrageZuordnung() {
    }

    public ManualManualFrageZuordnung(Integer nr) {
        this.nr = nr;
    }

    public Integer getNr() {
        return nr;
    }

    public void setNr(Integer nr) {
        this.nr = nr;
    }

    public ManualFrage getManualFrageNr() {
        return manualFrageNr;
    }

    public void setManualFrageNr(ManualFrage manualFrageNr) {
        this.manualFrageNr = manualFrageNr;
    }

    public Manual getManualNr() {
        return manualNr;
    }

    public void setManualNr(Manual manualNr) {
        this.manualNr = manualNr;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (nr != null ? nr.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof ManualManualFrageZuordnung)) {
            return false;
        }
        ManualManualFrageZuordnung other = (ManualManualFrageZuordnung) object;
        if ((this.nr == null && other.nr != null) || (this.nr != null && !this.nr.equals(other.nr))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "at.prospect.manualcreator.ManualManualFrageZuordnung[ nr=" + nr + " ]";
    }
    
}
